Repository navigation
feat(api): hot reload applies only the records that changed - #202
Merged
Merged
Conversation
themightychris
added a commit
that referenced
this pull request
Oct 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
A full rebuild re-reads every sheet while holding the write lock, and the full import has OOM'd that path before. Apply the commit diff instead, with a full-rebuild fallback for config changes and bulk merges, and require the result to equal a full rebuild. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hot reload re-read every sheet while holding the write lock. Now it diffs each in-memory sheet from the pre-reconcile commit (gitsheets Sheet.diffFrom) and unindexes/indexes just the changed records, with unindex* written as the exact inverse of index*. Falls back to the full rebuild when a sheet config changed or more than 5,000 records moved. The equivalence test checks the incrementally updated state deep-equals a full load across adds, edits, renames and deletes; breaking a single unindex function fails it. The webhook response reports reloadMode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
themightychris
force-pushed
the
fix/slug-rename-attachments
branch
from
October 14, 2026 02:26
0bbf1c8 to
de0fa36
Compare
themightychris
force-pushed
the
feat/incremental-reload
branch
from
October 14, 2026 02:26
bdd9621 to
044fe1f
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
plans/incremental-reload.md. Stacked on #201.After #200, hot reload holds the write lock while it rebuilds. Today that rebuild re-reads every sheet, which is the same full load that has run out of memory before. Now it applies only the records that changed.
How:
Sheet.diffFrom(<pre-reconcile commit>, { records: true })lists what changed, and the old and new versions of each record are unindexed and indexed in the live state and the FTS index.unindex*functions instate.tsare exact inverses of the loaders'index*, which is what makes the result equal to a full load..gitsheets/config changed or more than 5,000 records changed (a bulk import merge).diffFromget thegitsheets-sheet/gitsheets-pathannotations thatqueryAll()adds, because gitsheets' delete and upsert rely on them.reloadMode.The guard:
incremental-reload.test.tsmakes upstream adds, edits, renames and deletes across every in-memory sheet, then checks that the live state deep-equals a full load of the new tree, and checks search results. Breaking a singleunindex*makes it fail; I checked. It also covers the config-change fallback and deleting an incrementally loaded record through gitsheets.Spec:
storage.md→ Hot reload: incremental by default, the full-rebuild fallback, and the requirement that both produce the same result.Validation: type-check, lint and the full suite pass (501 API tests). Sandbox timing and heap measurements are left for after a release.
🤖 Generated with Claude Code